package com.sunwhite.dubbo.controller;

import com.sunwhite.dubbo.service.DemoService;
import org.apache.dubbo.config.annotation.Reference;
import org.apache.dubbo.rpc.RpcContext;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("demo")
public class DemoController {
//,group = "*"
    @Reference(version = "1.0.0",interfaceClass = DemoService.class)
    private DemoService demoService;

    @RequestMapping("hello")
    public String hello(){
        //隐式传参
        RpcContext.getContext().setAttachment("arg","123");
        return demoService.sayHello("hello");
    }
}
